
#ifndef _ILIBRARY_H_
#define _ILIBRARY_H_

#include <BMap>
#include <BEnum>
#include <BScript>
#include "member_BClass.h"

namespace BWE
{
	class FuncInfo : public BThing
	{
	public:
		inline FuncInfo()
		{
			line = -1;
			cfunc = 0;
		}

		inline bool empty() const
		{
			return cfunc == 0 && sfunc == 0;
		}

		int				line;
		BString			type;
		Function		cfunc;
		BExpHolder		sfunc;
		ParamInfoArray	params;
	};
	typedef BArray<FuncInfo*>		FuncInfoArray;
	typedef BHolder<FuncInfo>		FuncInfoHolder;
	typedef BArray<FuncInfoHolder>	FuncInfoHolderArray;

	class ILibrary
	{
	public:
		ILibrary(const char* name);

		bool empty() const;
		void registFunction(const BString& declare, Function function);
		void registVariant(const char* type, const char* name, const BValue& value = BValue());

		BString							name;
		BArray<VariantInfo>				variants;
		BMap<BString, FuncInfoHolder>	functionMap;
	};
}

#endif
